<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查询信息</title>

    <script type="text/javascript">
        function getInfoFromMysql()
        {
            var request;
            if (window.XMLHttpRequest)
            {
                //  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                request = new XMLHttpRequest();
            }
            else
            {
                // IE6, IE5 浏览器执行代码
                request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            request.onreadystatechange=function()
            {
                if (request.readyState == 4 && request.status == 200)
                {
                    document.getElementById("myDiv").innerHTML=request.responseText;
                }
            };
            request.open("GET","mysql.php", true);
            request.send();
        }
    </script>
</head>
<body>

<div id="myDiv"><h2>使用 AJAX 获取mysql中的数据</h2></div>
<button type="button" onclick="getInfoFromMysql()">展示内容</button>

</body>
</html>
